<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/WEB-INF/templates/template_interno_padrao.xhtml">
	
	<ui:define name="conteudo">
		
		<h2>Listagem de Contratos</h2>
		
		<h:form id="frmListagem">
				
			<p:dataTable id="dtlista" value="#{contratoBean.contratos}" var="contrato" widgetVar="tabelaDeContratos" emptyMessage="NENHUM CONTRATO" cellpadding="5" border="1" >
				
       			<p:column headerText="Contrato">
					<h:link outcome="editarContrato" value="#{contrato.id}" style="text-decoration: underline;">
						<f:param name="id" value="#{contrato.id}" />
					</h:link>
				</p:column>
				
				<p:column headerText="Estabelecimento" filterBy="#{contrato.localPrestacaoServico.descricao}" filterMatchMode="contains">
					<h:outputText value="#{contrato.localPrestacaoServico.descricao}"/>
				</p:column>
				
				<p:column headerText="Bairro">
					<h:outputText value="#{contrato.localPrestacaoServico.endereco.bairro}"/>
				</p:column>
				
				<p:column headerText="Cliente" filterBy="#{contrato.contratante.nome}" filterMatchMode="contains">
					<h:outputText value="#{contrato.contratante.nome}"/>
				</p:column>
				
				<p:column headerText="CPF">
					<h:outputText value="#{contrato.contratante.cpfCnpj.numero}">
						<f:converter converterId="CpfCnpjConverter"/>
					</h:outputText>
				</p:column>
				
				<p:column headerText="Serviço">
					<h:outputText value="#{contrato.servicoPrincipal}"/>
				</p:column>
				
				<p:column headerText="Status contrato">
					<h:outputText value="#{contrato.situacao.descricao}"/>
				</p:column>
				
				<!-- <p:column headerText="Ação">
					<p:commandButton value="Editar | Visualizar" action="#{contratoBean.doEstadoEdicao}" update="@form :titulo_pagina" icon="ui-icon-pencil" title="Editar">
						<f:setPropertyActionListener value="#{contrato}" target="#{contratoBean.contratoSelecionado}"/>
					</p:commandButton>
				</p:column> -->
				
			</p:dataTable>
		</h:form>
		
	</ui:define>

</ui:composition>      
	
</html>